package com.thread.TimeDown;

import javax.xml.crypto.Data;
import java.text.SimpleDateFormat;
import java.util.Date;

public class testSleep {
    public static void main(String[] args) {
      Date starTime = new Date(System.currentTimeMillis());
      while (true){
          try {
              Thread.sleep(1000);
              System.out.println(new SimpleDateFormat("HH:mm:ss").format(starTime));//格式化时间
              starTime = new Date(System.currentTimeMillis());//重新赋值
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
      }

    }

//    public static void tenDown() throws InterruptedException {
//        int num =10;
//        while (true){
//            Thread.sleep(1000);
//            System.out.println(num--);
//            if(num<0){
//                break;
//            }
//
//        }
//    }
}
